1. Field of the Invention
The present invention relates to an image detection method for detecting a predetermined part from an image of an object and a length measurement apparatus for measuring a length of the detected part. More particularly, the present invention relates to the image detection method and the length measurement apparatus in which image detection is realized by performing a plurality of processes.
2. Description of the Related Art
According to a conventional image detection method for a desired partial image from an image of an object, data of the image of the object is first obtained, and the obtained image data of the object is then scanned entirely by using a template containing the same pattern as a pattern to be contained in the partial image, thereby detecting the partial image. The conventional image detection method is described referring to FIG. 1.
FIG. 1 illustrates the conventional image detection method. In this example, a case of detecting a partial image that is substantially the same as a target image 14 from an image 10 of a part of an object is described. First, a partial image at a position 16a is compared to the target image 14 so as to obtain a correlation value between the partial image at the position 16a and the target image 14. Then, a partial image at a position shifted from the position 16a by a very small distance is compared to the target image 16 so as to obtain a correlation value with the target image 14. In this manner, the image 10 is scanned by shifting the position at which the comparison with the target image 14 is performed from an upper-left corner to a lower-right corner until a position 16c, thereby obtaining correlation values with the target image 14 for all the positions in the image 10. From the obtained correlation values, a position at which the maximum correlation value is obtained is then detected. In the example shown in FIG. 1, the maximum correlation value is obtained in a position 16b, and thus the partial image substantially the same as the target image is detected. This method is also used in a conventional length measurement apparatus that can measure a length of a part in order to detect the part to be measured.
The conventional image detection method and the conventional length measurement apparatus described above, however, have the following disadvantage. According to the above-described image detection method, the image detection is not efficient since the image data is entirely scanned for detecting a desired partial image, and therefore it takes much time to detect the desired partial image.
Therefore, it is an object of the present invention to provide an image detection method and a length measurement apparatus, which are capable of overcoming the above drawbacks accompanying the conventional art. The above and other objects can be achieved by combinations described in the independent claims. The dependent claims define further advantageous and exemplary combinations of the present invention.
According to the first aspect of the present invention, an image detection method for detecting a target image from an image of an object having a band-like pattern extending along a predetermined direction, the target image containing at least part of the band-like pattern, the method comprises: storing at least part of the image of the object as image data; detecting a first partial image from the stored image data based on a first template containing a first band-like template pattern that extends along the predetermined direction, the first partial image being an image of a first partial region containing substantially the same pattern as the first band-like template pattern; and detecting a second partial image, as the target image, in a region that extends from the first partial region along the predetermined direction based on the target image containing the at least part of the band-like pattern of the object, the second partial image being an image of a second partial region containing substantially the same pattern as that contained in the target image.
A region for which the image data is stored may have at least first and second sides crossing each other, the second side being substantially parallel to the predetermined direction, the detection of the first partial image is performed by scanning a first scanning region that is a part of the region for which the image data is stored, along the first side, and the detection of the second partial image is performed by scanning, along the second side, a second scanning region that extends from the first partial region along the predetermined direction.
The first and second scanning regions may cross substantially at right angles.
The band-like pattern of the object may reach an end of the region for which the image data is stored, the end including the first side. The first scanning region for which the scanning for the detection of the first partial image is performed may include the end.
The length of the first band-like template pattern in a direction along the first side may be substantially equal to the length of the pattern contained in the target image in the direction along the first side.
The length of a side of the first scanning region, that is substantially perpendicular to the first side, may be equal to the length of a side of the first template, that is substantially perpendicular to the first side.
The length of a side of the second scanning region, that is substantially perpendicular to the predetermined direction, may be equal to the length of a side of the target image that is substantially perpendicular to the predetermined direction.
The first partial image may be detected by a single scanning along the first side while the second partial image is detected by a single scanning along the second side.
According to the second aspect of the present invention, a length measurement method for measuring a length of a part to be measured of an object having a band-like pattern extending along a predetermined direction, comprises: detecting a target image from an image of the object, the target image containing at least part of the band-like pattern, a relative position of the part to be measured with respect to a position of the target image being known; detecting the part to be measured based on the position of the target image; and measuring the length of the part to be measured. The detection of the target image comprises: storing at least a part of the image of the object as image data; detecting a first partial image from the stored image data based on a first template containing a first band-like template pattern that extends along the predetermined direction, the first partial image being an image of a first partial region containing substantially the same pattern as the first band-like template pattern; and detecting a second partial image, as the target image, in a region that extends from the first partial region along the predetermined direction based on the target image containing the at least part of the band-like pattern of the object, the second partial image being an image of a second partial region containing substantially the same pattern as that of the target image.
According to the third aspect of the present invention, a length measurement apparatus for measuring a length of a part of an object having a band-like pattern extending along a predetermined direction, comprises: an image data storing unit operable to store at least a part of an image of the object as image data; a first image detecting unit operable to detect a first partial image from the image data stored in the image data storing unit based on a template containing a band-like template pattern that extends along the predetermined direction, the first partial image being an image of a first partial region containing substantially the same pattern as the band-like template pattern; a second image detecting unit operable to detect a second partial image in a region that extends from the first partial region along the predetermined direction based on a further template containing a predetermined pattern, the second partial image being an image of a second partial region containing substantially the same pattern as the predetermined pattern of the further template; third image detecting unit operable to detect the part to be measured based on a position at which the second partial image is detected, a positional relationship between the part to be measured and the position being known; and a length measuring unit operable to detect the length of the part.
The summary of the invention does not necessarily describe all necessary features of the present invention. The present invention may also be a sub-combination of the features described above. The above and other features and advantages of the present invention will become more apparent from the following description of the embodiments taken in conjunction with the accompanying drawings.